import { Category } from "./../../cartogery/type";
/*
 * @Author: c
 * @Date: 2024-01-20 14:29:42
 * @LastEditTime: 2024-02-26 12:14:34
 * @LastEditors: c
 * @Description:
 * @FilePath: \music-web-admin\src\api\application\song\types.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { Artist } from "@/api/artist/type";
import { UploadFileDto, UploadVideoForm } from "@/api/minio/type";
import { AudioRateEnum } from "@/enums";
import { UploadFile } from "element-plus";
import { AlbumForm } from "../album/type";

/**
 * 类别查询参数类型
 */
export interface SongQuery extends PageQuery {
  songName?: string;
  artistIds?: number[];
}

/**
 * 类别视图对象类型
 */
export interface SongVO {
  /**
   * 子菜单
   */
  children?: SongVO[];

  /**
   * ICON
   */
  icon?: string;
  /**
   * 菜单ID
   */
  id?: number;
  /**
   * 菜单名称
   */
  name?: string;
  /**
   * 父菜单ID
   */
  parentId?: number;

  /**
   * 菜单排序(数字越小排名越靠前)
   */
  sort?: number;
}

/**
 * 菜单表单对象类型
 */
export interface SongForm {
  /**
   * 歌曲ID
   */
  id?: number;
  /**
   * 歌手ID列表
   */
  artistIds: number[];

  /**
   * 专辑ID列表
   */
  albumIds: number[];

  album?: AlbumForm;
  /**
   * 歌手列表
   */
  artistList?: Artist[];

  //歌曲标题
  title: string;
  //标签
  genre?: number | string | Category[];
  //封面图
  pic: UploadFileDto[];
  //mv
  video?: UploadVideoForm;
  //音质
  rateList: AudioRateEnum[];
  // rateFileInfos?: RateFileInfo[];
  //发行日期
  releaseDate: Date;
  //下架时间
  downTime: Date;
  //上架时间
  pushTime: Date;
  //语言
  lang: string;
  //歌词
  lyric: string;
  //简介
  introduce: string;
  //种类是否激活
  isActive: boolean;
  //是否是VIP歌曲
  isVip: boolean;
  /**
   * 排序
   */
  sort: number;
  rateFileInfos: RateFileInfo[];
  // rateFileList: RateFileInfo[];
}

export interface TrackLinkQueryDto {
  id: number;
}

export interface TrackLinkVO {
  value: TrackLinkVO;
  duration: number;
  startTime: number;
  rate: AudioRateEnum;
  expireTime: number;
  id: number;
  path: string;
  title: string;
}

export type UploadSongStatus =
  | "notReady"
  | "ready"
  | "transforming"
  | "transformed"
  | "uploading"
  | "success"
  | "fail";
export interface RateFileInfo {
  id?: number;

  //音频质量
  rate: AudioRateEnum;

  //资源的size大小
  size: number;

  //资源的格式
  format: string;

  //歌曲时长
  duration: number;

  //是否是完整的
  isFull: boolean;
  //上传进度
  percentage?: number;
  //转码进度
  transformProgress: number;

  //上传完成返回的文件id
  fileId: string;

  //文件
  file?: UploadFile;
  blob?: Blob;
  mimeType?: string;
  //操作状态
  status?: UploadSongStatus;

  //资源名称
  name?: string;
}

export interface DelRateFileDto {
  // id: number;
  rateFileIds: string[];
}
